<template>
	<view class="Menu">
		<!-- 导航条 :style="{ height: $wanlshop.wanlsys().height + 'px' }"-->
		<view class="cu-custom">
			<view class="cu-bar fixed" style="background: #fff;"
				:style="{height: $wanlshop.wanlsys().height + 'px',paddingTop: $wanlshop.wanlsys().top + 'px',}">
				<view class="action">
					<text class="wlIcon-fanhui1" style="margin-left: 0" @tap="$wanlshop.back(1)"></text>
				</view>
				<view class="content" :style="{ top: $wanlshop.wanlsys().top + 'px' }">
					抽奖券兑换
				</view>
				<view class="action">
					<text class="wlIcon-gengduo" @tap="showModal('share')"></text>
				</view>
			</view>
		</view>
		<view class="transferBox">
			<view class="assets">
				<view class="assetsT">
					<view class="title">兑换张数</view>
				</view>
				<view class="assetsM">
					<view class="assetsInput">

						<u-input border='none' type='number' v-model.trim="Inputmoney" @blur='blur'
							:onkeyup="Inputmoney = (Inputmoney || '').replace(/[^A-z0-9]/, '')"></u-input>
					</view>
					<view class="assetsmMoney">
						价格:{{money||0}}
					</view>
				</view>
			</view>
			<!-- <view class="assets">
				<view class="assetsT">
					<view class="title">价格</view>
				</view>
				<view class="assetsM">
					<view class="assetsInput">
						{{Inputmoney1}}
					</view>
				</view>
			</view> -->
		</view>
		<view class="uni-btn">
			<button class="uni-btn-v" @click="formSubmit">确认兑换</button>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				Inputmoney: '0',
				money: '0',
			};
		},
		methods: {
			blur() {
				uni.request({
					url: "/user/config",
					method: 'POST',
					success: (res) => {
						if (res.res.code == 1) {
							this.money = this.Inputmoney * res.res.data.draw_yld
						}
					},
				});
			},
			formSubmit() {
				uni.request({
					url: "/user/drawYld",
					method: 'POST',
					data: {
						sum: this.Inputmoney,
					},
					success: (res) => {
						if (res.res.code == 1) {
							this.$wanlshop.msg(res.res.msg);
							this.money = '0'
							this.Inputmoney = '0'
						}
					},
				});
			}

		}
	};
</script>

<style lang="scss">
	.Menu {
		background: #f8f8f8;

		.transferBox {
			padding: 0 24rpx;

			.assets {
				padding: 38rpx 30rpx 34rpx 30rpx;
				background: #fff;
				border-radius: 16rpx;
				margin-top: 24rpx;

				.assetsT {
					display: flex;
					align-items: center;
					justify-content: space-between;
					margin-bottom: 20rpx;

					.title {
						font-weight: 400;
						font-size: 28rpx;
						color: #333333;
						line-height: 48rpx;
					}

					.pick {
						background: #F3F3F3;
						border-radius: 4rpx;
						padding: 5rpx 6rpx 5rpx 24rpx;
						font-weight: 400;
						font-size: 24rpx;
						color: #666666;
						line-height: 48rpx;
						min-width: 112rpx;
						display: flex;
						align-items: center;
						justify-content: space-between;
					}
				}

				.assetsM {
					display: flex;
					align-items: center;
					justify-content: space-between;

					.assetsInput {
						width: 50%;
						font-weight: 600;
						font-size: 52rpx !important;
						color: #FF443C !important;
						line-height: 48rpx !important;

						/deep/.u-input__content__field-wrapper__field,
						.Inputmoney1 {
							font-weight: 600;
							font-size: 52rpx !important;
							color: #FF443C !important;
							line-height: 48rpx !important;
						}
					}

					.assetsmMoney {
						font-weight: 400;
						font-size: 24rpx;
						color: #999999;
						line-height: 48rpx;
					}
				}
			}

			.usdtbl {
				font-weight: 400;
				font-size: 28rpx;
				color: #999999;
				line-height: 48rpx;
				margin-top: 30rpx;
			}
		}

		.uni-btn-v {
			width: 702rpx;
			height: 96rpx;
			background: #eb5641;
			border-radius: 16rpx 16rpx 16rpx 16rpx;
			margin-top: 40rpx;
			font-weight: 400;
			font-size: 28rpx;
			color: #ffffff;
			line-height: 96rpx;
			margin-top: 280rpx;
		}
	}
</style>